<template>
    <transition name="modal">
        <div class="modal-mask" v-show="open">
                <div class="modal-container">
    
                    <div class="modal-header">
                        <div class="row">
                            <div class="col-lg-12">
                                <h4>渠道详情</h4>
                            </div>
                            
                        </div>
                       
                        
                        <button type="button" class="close" @click="$emit('close')">
                            <i class="fa fa-times" aria-hidden="true"></i>
                        </button>
                    </div>
    
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">渠道ID：</label>
                                        <div class="col-sm-8">
                                            <p class="form-control-static">{{appid}}</p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">客户名称：</label>
                                        <div class="col-sm-8"> 
                                            <p class="form-control-static">{{customer_name}}</p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">状态：</label>
                                        <div class="col-sm-8">
                                            <p class="form-control-static">{{state=='0'?'启用':'禁用'}}</p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">秘钥：</label>
                                        <div class="col-sm-8">
                                            <p class="form-control-static">{{secret_key}}</p>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">输出检出项：</label>
                                        <div class="col-sm-8 limte-height">
                                            <ul class="list-group">
                                                <li class="list-group-item">
                                                    <div class="row">
                                                        <div class="col-lg-4">
                                                            序号
                                                        </div>
                                                        <div class="col-lg-8">检测项ID</div>
                                                    </div>
                                                </li>
                                                <template v-for="(item,i) in cases">
                                                    <li class="list-group-item" :key="i">
                                                        <div class="row">
                                                            <div class="col-lg-4">{{i+1}}</div>
                                                            <div class="col-lg-8">{{item}}</div>
                                                        </div>
                                                    </li>
                                                </template>
                                            </ul>
                                                   
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
    
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" @click="$emit('close')"> 取 消 </button>
                    </div>
                </div>
            
        </div>
    </transition>
</template>
<script>
import {tip,ajax} from '../../tools/tools.js'

export default {
    name: 'DelGoodsModal',
    data() {
        return {
            appid:'',
            customer_name:'',
            state:'0',
            secret_key:'',
            cases:[]
        }
    },
    props:{
        open:{
            type:Boolean,
            default:false
        },
        channelId:{
            type:String,
            default:''
        }
    },
    computed:{
        
    },
    watch:{
        open(v,ov){
            if(v==false){
                this.cases = [];
            }
        },
        channelId(v,ov){
            var self = this;
            if(v!=''){
                self.appid = v;
                self.getChannelDetail();   
            }
        }
    },
    methods: {
        getChannelDetail(){
            var self = this;
            ajax.getChannelDetail({
                param:{appid:self.appid},
                cb(data){
                    self.customer_name = data.data.customer_name;
                    self.state = data.data.state;
                    self.cases = data.data.cases;
                    self.secret_key = data.data.secret_key;
                }
            })
        }
    },
    mounted() {
        
    }
}
</script>
<style scoped>
.close {
    position: absolute;
    right: 30px;
    top: 30px;
}

.modal-mask {
    position: fixed;
    z-index: 10001;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: rgba(0, 0, 0, .5);
    transition: opacity .3s ease;
}

.limte-height{
    max-height: 250px;
    overflow-x: hidden;
    overflow-y: auto;
}

.modal-container {
    position: absolute;
    left: 210px;
    top: 70px;
    bottom: 20px;
    right: 20px;
    padding: 20px 30px;
    background-color: #fff;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
    transition: all .3s ease;
}

.modal-header h3 {
    margin-top: 0;
    color: #42b983;
}

.modal-default-button {
    float: right;
}

.modal-enter {
    opacity: 0;
}

.modal-leave-active {
    opacity: 0;
}

.modal-enter .modal-container,
.modal-leave-active .modal-container {
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}
</style>
